.class public Les/pd0;
.super Ljava/lang/Object;
.source "NtlmAuthenticator.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Les/pd0$a;
    }
.end annotation


# static fields
.field private static final a:Lcom/hierynomus/asn1/m;


# direct methods
.method static constructor <clinit>()V
    .locals 2

    .line 1
    sget-object v0, Les/sc0;->a:Lcom/hierynomus/asn1/m;

    const-string v1, "2.2.10"

    invoke-virtual {v0, v1}, Lcom/hierynomus/asn1/m;->b(Ljava/lang/String;)Lcom/hierynomus/asn1/m;

    move-result-object v0

    sput-object v0, Les/pd0;->a:Lcom/hierynomus/asn1/m;

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method private a(Lcom/hierynomus/ntlm/messages/a;[B)[B
    .locals 2

    .line 44
    new-instance v0, Lcom/hierynomus/spnego/b;

    invoke-direct {v0}, Lcom/hierynomus/spnego/b;-><init>()V

    .line 45
    invoke-virtual {v0, p2}, Lcom/hierynomus/spnego/b;->b([B)V

    .line 46
    new-instance p2, Lcom/hierynomus/protocol/commons/buffer/Buffer$b;

    sget-object v1, Lcom/hierynomus/protocol/commons/buffer/a;->a:Lcom/hierynomus/protocol/commons/buffer/a;

    invoke-direct {p2, v1}, Lcom/hierynomus/protocol/commons/buffer/Buffer$b;-><init>(Lcom/hierynomus/protocol/commons/buffer/a;)V

    .line 47
    invoke-virtual {p1, p2}, Lcom/hierynomus/ntlm/messages/a;->a(Lcom/hierynomus/protocol/commons/buffer/Buffer$b;)V

    .line 48
    invoke-virtual {p2}, Lcom/hierynomus/protocol/commons/buffer/Buffer;->d()[B

    move-result-object p1

    invoke-virtual {v0, p1}, Lcom/hierynomus/spnego/b;->b([B)V

    .line 49
    new-instance p1, Lcom/hierynomus/protocol/commons/buffer/Buffer$b;

    sget-object p2, Lcom/hierynomus/protocol/commons/buffer/a;->a:Lcom/hierynomus/protocol/commons/buffer/a;

    invoke-direct {p1, p2}, Lcom/hierynomus/protocol/commons/buffer/Buffer$b;-><init>(Lcom/hierynomus/protocol/commons/buffer/a;)V

    .line 50
    invoke-virtual {v0, p1}, Lcom/hierynomus/spnego/b;->b(Lcom/hierynomus/protocol/commons/buffer/Buffer;)V

    .line 51
    invoke-virtual {p1}, Lcom/hierynomus/protocol/commons/buffer/Buffer;->d()[B

    move-result-object p1

    return-object p1
.end method

.method private a(Lcom/hierynomus/ntlm/messages/c;)[B
    .locals 3

    .line 36
    new-instance v0, Lcom/hierynomus/spnego/a;

    invoke-direct {v0}, Lcom/hierynomus/spnego/a;-><init>()V

    .line 37
    sget-object v1, Les/pd0;->a:Lcom/hierynomus/asn1/m;

    invoke-virtual {v0, v1}, Lcom/hierynomus/spnego/a;->a(Lcom/hierynomus/asn1/m;)V

    .line 38
    new-instance v1, Lcom/hierynomus/protocol/commons/buffer/Buffer$b;

    sget-object v2, Lcom/hierynomus/protocol/commons/buffer/a;->a:Lcom/hierynomus/protocol/commons/buffer/a;

    invoke-direct {v1, v2}, Lcom/hierynomus/protocol/commons/buffer/Buffer$b;-><init>(Lcom/hierynomus/protocol/commons/buffer/a;)V

    .line 39
    invoke-virtual {p1, v1}, Lcom/hierynomus/ntlm/messages/c;->a(Lcom/hierynomus/protocol/commons/buffer/Buffer$b;)V

    .line 40
    invoke-virtual {v1}, Lcom/hierynomus/protocol/commons/buffer/Buffer;->d()[B

    move-result-object p1

    invoke-virtual {v0, p1}, Lcom/hierynomus/spnego/a;->b([B)V

    .line 41
    new-instance p1, Lcom/hierynomus/protocol/commons/buffer/Buffer$b;

    sget-object v1, Lcom/hierynomus/protocol/commons/buffer/a;->a:Lcom/hierynomus/protocol/commons/buffer/a;

    invoke-direct {p1, v1}, Lcom/hierynomus/protocol/commons/buffer/Buffer$b;-><init>(Lcom/hierynomus/protocol/commons/buffer/a;)V

    .line 42
    invoke-virtual {v0, p1}, Lcom/hierynomus/spnego/a;->b(Lcom/hierynomus/protocol/commons/buffer/Buffer;)V

    .line 43
    invoke-virtual {p1}, Lcom/hierynomus/protocol/commons/buffer/Buffer;->d()[B

    move-result-object p1

    return-object p1
.end method


# virtual methods
.method public a(Lcom/hierynomus/smbj/connection/a;Les/od0;)J
    .locals 19
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lcom/hierynomus/smbj/transport/TransportException;
        }
    .end annotation

    move-object/from16 v1, p0

    move-object/from16 v0, p1

    .line 1
    :try_start_0
    sget-object v2, Lcom/hierynomus/smbj/smb2/messages/SMB2SessionSetup$SMB2SecurityMode;->SMB2_NEGOTIATE_SIGNING_ENABLED:Lcom/hierynomus/smbj/smb2/messages/SMB2SessionSetup$SMB2SecurityMode;

    .line 2
    invoke-static {v2}, Ljava/util/EnumSet;->of(Ljava/lang/Enum;)Ljava/util/EnumSet;

    move-result-object v2

    .line 3
    new-instance v3, Lcom/hierynomus/smbj/smb2/messages/SMB2SessionSetup;

    invoke-virtual/range {p1 .. p1}, Lcom/hierynomus/smbj/connection/a;->i()Lcom/hierynomus/smbj/smb2/SMB2Dialect;

    move-result-object v4

    invoke-direct {v3, v4, v2}, Lcom/hierynomus/smbj/smb2/messages/SMB2SessionSetup;-><init>(Lcom/hierynomus/smbj/smb2/SMB2Dialect;Ljava/util/EnumSet;)V

    .line 4
    new-instance v4, Lcom/hierynomus/ntlm/messages/c;

    invoke-direct {v4}, Lcom/hierynomus/ntlm/messages/c;-><init>()V

    .line 5
    invoke-direct {v1, v4}, Les/pd0;->a(Lcom/hierynomus/ntlm/messages/c;)[B

    move-result-object v4

    .line 6
    invoke-virtual {v3, v4}, Lcom/hierynomus/smbj/smb2/messages/SMB2SessionSetup;->a([B)V

    .line 7
    invoke-virtual {v0, v3}, Lcom/hierynomus/smbj/connection/a;->b(Lcom/hierynomus/smbj/smb2/d;)Ljava/util/concurrent/Future;

    move-result-object v3

    .line 8
    sget-object v4, Lcom/hierynomus/smbj/transport/TransportException;->Wrapper:Les/fd0;

    invoke-static {v3, v4}, Les/gd0;->a(Ljava/util/concurrent/Future;Les/fd0;)Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Lcom/hierynomus/smbj/smb2/messages/SMB2SessionSetup;

    .line 9
    invoke-virtual {v3}, Lcom/hierynomus/smbj/smb2/d;->a()Lcom/hierynomus/smbj/smb2/c;

    move-result-object v4

    invoke-virtual {v4}, Lcom/hierynomus/smbj/smb2/c;->e()J

    move-result-wide v4

    .line 10
    invoke-virtual {v3}, Lcom/hierynomus/smbj/smb2/d;->a()Lcom/hierynomus/smbj/smb2/c;

    move-result-object v6

    invoke-virtual {v6}, Lcom/hierynomus/smbj/smb2/c;->f()Lcom/hierynomus/mserref/NtStatus;

    move-result-object v6

    sget-object v7, Lcom/hierynomus/mserref/NtStatus;->STATUS_MORE_PROCESSING_REQUIRED:Lcom/hierynomus/mserref/NtStatus;

    if-ne v6, v7, :cond_2

    .line 11
    invoke-virtual {v3}, Lcom/hierynomus/smbj/smb2/messages/SMB2SessionSetup;->c()[B

    move-result-object v3

    .line 12
    new-instance v6, Lcom/hierynomus/spnego/b;

    invoke-direct {v6}, Lcom/hierynomus/spnego/b;-><init>()V

    invoke-virtual {v6, v3}, Lcom/hierynomus/spnego/b;->a([B)Lcom/hierynomus/spnego/b;

    .line 13
    invoke-virtual {v6}, Lcom/hierynomus/spnego/b;->a()Ljava/math/BigInteger;

    .line 14
    new-instance v3, Lcom/hierynomus/ntlm/messages/b;

    invoke-direct {v3}, Lcom/hierynomus/ntlm/messages/b;-><init>()V

    new-instance v7, Lcom/hierynomus/protocol/commons/buffer/Buffer$b;

    invoke-virtual {v6}, Lcom/hierynomus/spnego/b;->b()[B

    move-result-object v8

    sget-object v9, Lcom/hierynomus/protocol/commons/buffer/a;->a:Lcom/hierynomus/protocol/commons/buffer/a;

    invoke-direct {v7, v8, v9}, Lcom/hierynomus/protocol/commons/buffer/Buffer$b;-><init>([BLcom/hierynomus/protocol/commons/buffer/a;)V

    invoke-virtual {v3, v7}, Lcom/hierynomus/ntlm/messages/b;->a(Lcom/hierynomus/protocol/commons/buffer/Buffer$b;)Lcom/hierynomus/ntlm/messages/d;

    check-cast v3, Lcom/hierynomus/ntlm/messages/b;

    .line 15
    invoke-virtual {v3}, Lcom/hierynomus/ntlm/messages/b;->b()[B

    move-result-object v7

    .line 16
    invoke-virtual/range {p2 .. p2}, Les/od0;->b()[C

    move-result-object v8

    invoke-static {v8}, Ljava/lang/String;->valueOf([C)Ljava/lang/String;

    move-result-object v8

    invoke-virtual/range {p2 .. p2}, Les/od0;->c()Ljava/lang/String;

    move-result-object v9

    invoke-virtual/range {p2 .. p2}, Les/od0;->a()Ljava/lang/String;

    move-result-object v10

    invoke-static {v8, v9, v10}, Les/cd0;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)[B

    move-result-object v8

    .line 17
    invoke-virtual {v3}, Lcom/hierynomus/ntlm/messages/b;->c()[B

    move-result-object v9

    invoke-static {v9}, Les/cd0;->a([B)[B

    move-result-object v9

    .line 18
    invoke-static {v8, v7, v9}, Les/cd0;->a([B[B[B)[B

    move-result-object v12

    const/4 v7, 0x0

    .line 19
    invoke-virtual {v3}, Lcom/hierynomus/ntlm/messages/b;->a()Ljava/util/EnumSet;

    move-result-object v9

    sget-object v10, Lcom/hierynomus/ntlm/messages/NtlmNegotiateFlag;->NTLMSSP_NEGOTIATE_SIGN:Lcom/hierynomus/ntlm/messages/NtlmNegotiateFlag;

    invoke-virtual {v9, v10}, Ljava/util/EnumSet;->contains(Ljava/lang/Object;)Z

    move-result v9

    const/4 v10, 0x0

    if-eqz v9, :cond_0

    const/4 v7, 0x1

    new-array v7, v7, [[B

    const/16 v9, 0x10

    .line 20
    invoke-static {v12, v10, v9}, Ljava/nio/ByteBuffer;->wrap([BII)Ljava/nio/ByteBuffer;

    move-result-object v11

    invoke-virtual {v11}, Ljava/nio/ByteBuffer;->array()[B

    move-result-object v11

    aput-object v11, v7, v10

    .line 21
    invoke-static {v8, v7}, Les/cd0;->a([B[[B)[B

    move-result-object v7

    .line 22
    invoke-virtual {v3}, Lcom/hierynomus/ntlm/messages/b;->a()Ljava/util/EnumSet;

    move-result-object v3

    sget-object v8, Lcom/hierynomus/ntlm/messages/NtlmNegotiateFlag;->NTLMSSP_NEGOTIATE_KEY_EXCH:Lcom/hierynomus/ntlm/messages/NtlmNegotiateFlag;

    invoke-virtual {v3, v8}, Ljava/util/EnumSet;->contains(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_0

    new-array v3, v9, [B

    .line 23
    invoke-static {}, Les/cd0;->a()Ljava/security/SecureRandom;

    move-result-object v8

    invoke-virtual {v8, v3}, Ljava/security/SecureRandom;->nextBytes([B)V

    .line 24
    invoke-static {v7, v3}, Les/cd0;->a([B[B)[B

    move-result-object v3

    move-object/from16 v16, v3

    goto :goto_0

    :cond_0
    move-object/from16 v16, v7

    .line 25
    :goto_0
    new-instance v3, Lcom/hierynomus/smbj/smb2/messages/SMB2SessionSetup;

    invoke-virtual/range {p1 .. p1}, Lcom/hierynomus/smbj/connection/a;->i()Lcom/hierynomus/smbj/smb2/SMB2Dialect;

    move-result-object v7

    invoke-direct {v3, v7, v2}, Lcom/hierynomus/smbj/smb2/messages/SMB2SessionSetup;-><init>(Lcom/hierynomus/smbj/smb2/SMB2Dialect;Ljava/util/EnumSet;)V

    .line 26
    invoke-virtual {v3}, Lcom/hierynomus/smbj/smb2/d;->a()Lcom/hierynomus/smbj/smb2/c;

    move-result-object v2

    invoke-virtual {v2, v4, v5}, Lcom/hierynomus/smbj/smb2/c;->b(J)V

    .line 27
    new-instance v2, Lcom/hierynomus/ntlm/messages/a;

    new-array v11, v10, [B

    .line 28
    invoke-virtual/range {p2 .. p2}, Les/od0;->c()Ljava/lang/String;

    move-result-object v13

    invoke-virtual/range {p2 .. p2}, Les/od0;->a()Ljava/lang/String;

    move-result-object v14

    const/4 v15, 0x0

    sget-wide v17, Lcom/hierynomus/ntlm/messages/c;->b:J

    move-object v10, v2

    invoke-direct/range {v10 .. v18}, Lcom/hierynomus/ntlm/messages/a;-><init>([B[BLjava/lang/String;Ljava/lang/String;Ljava/lang/String;[BJ)V

    .line 29
    invoke-virtual {v6}, Lcom/hierynomus/spnego/b;->b()[B

    move-result-object v6

    invoke-direct {v1, v2, v6}, Les/pd0;->a(Lcom/hierynomus/ntlm/messages/a;[B)[B

    move-result-object v2

    .line 30
    invoke-virtual {v3, v2}, Lcom/hierynomus/smbj/smb2/messages/SMB2SessionSetup;->a([B)V

    .line 31
    invoke-virtual {v0, v3}, Lcom/hierynomus/smbj/connection/a;->b(Lcom/hierynomus/smbj/smb2/d;)Ljava/util/concurrent/Future;

    move-result-object v0

    .line 32
    sget-object v2, Lcom/hierynomus/smbj/transport/TransportException;->Wrapper:Les/fd0;

    invoke-static {v0, v2}, Les/gd0;->a(Ljava/util/concurrent/Future;Les/fd0;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/hierynomus/smbj/smb2/messages/SMB2SessionSetup;

    .line 33
    invoke-virtual {v0}, Lcom/hierynomus/smbj/smb2/d;->a()Lcom/hierynomus/smbj/smb2/c;

    move-result-object v2

    invoke-virtual {v2}, Lcom/hierynomus/smbj/smb2/c;->f()Lcom/hierynomus/mserref/NtStatus;

    move-result-object v2

    sget-object v3, Lcom/hierynomus/mserref/NtStatus;->STATUS_SUCCESS:Lcom/hierynomus/mserref/NtStatus;

    if-ne v2, v3, :cond_1

    goto :goto_1

    .line 34
    :cond_1
    new-instance v2, Lcom/hierynomus/ntlm/NtlmException;

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "Setup failed with "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Lcom/hierynomus/smbj/smb2/d;->a()Lcom/hierynomus/smbj/smb2/c;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hierynomus/smbj/smb2/c;->f()Lcom/hierynomus/mserref/NtStatus;

    move-result-object v0

    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {v2, v0}, Lcom/hierynomus/ntlm/NtlmException;-><init>(Ljava/lang/String;)V

    throw v2
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Lcom/hierynomus/protocol/commons/buffer/Buffer$BufferException; {:try_start_0 .. :try_end_0} :catch_0

    :cond_2
    :goto_1
    return-wide v4

    :catch_0
    move-exception v0

    goto :goto_2

    :catch_1
    move-exception v0

    .line 35
    :goto_2
    new-instance v2, Lcom/hierynomus/smbj/transport/TransportException;

    invoke-direct {v2, v0}, Lcom/hierynomus/smbj/transport/TransportException;-><init>(Ljava/lang/Throwable;)V

    throw v2
.end method
